package com.hxy.springcloud.controller;

import com.hxy.springcloud.pojo.Department;
import com.hxy.springcloud.service.DeptClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class DepartmentController {

    @Autowired
    private DeptClientService service = null;

    @PostMapping("/consume/dept/add")
    public boolean addDepartment(Department department) {
        return this.service.addDepartment(department);
    }

    @RequestMapping("/consume/dept/queryById/{id}")
    public Department queryDepartmentById(@PathVariable("id") long id) {
        return this.service.queryById(id);
    }

    @RequestMapping("/consume/dept/queryAll")
    public List<Department> queryAllDepartment() {
        return this.service.queryAllDepartment();
    }
}
